Skip to content

fix: pass the wheel to programs that report the mouse - #61

Merged
LukeGus merged 1 commit into
Termix-SSH:dev-1.4.0from
Kevsosmooth:fix/wheel-mouse-tracking
Nov 7, 2026
Merged

LukeGus merged 1 commit into
Termix-SSH:dev-1.4.0from
Kevsosmooth:fix/wheel-mouse-tracking

Conversation

@Kevsosmooth

Copy link
Copy Markdown

What

The custom wheel handler drops a plain wheel on a normal buffer with no scrollback yet (wheelHasNothingToScroll), so it does not turn into arrow keys that walk shell history. It does that even when the program has mouse reporting on. In that case xterm would send the wheel to the program as a mouse report, not as arrow keys, so nothing needs dropping, and the program never gets the wheel.

I hit this with tmux (mouse on) attached through agent-deck. Switching sessions leaves the alternate screen, clears the scrollback (CSI 3 J) and attaches tmux on the normal screen with ?1000h ?1002h ?1006h. The buffer is then normal, baseY 0 and mouseTrackingMode drag, and the wheel does nothing in tmux or in the app inside it. Any resize brings it back, because the reflow pushes lines into the scrollback (baseY > 0) and the check stops matching. So it looks random: scrolling dies after a session switch and returns when the sidebar opens or the window is resized.

This makes wheelHasNothingToScroll take terminal.modes.mouseTrackingMode and only drop the wheel when it is "none". Without mouse reporting nothing changes.

Changes

  • terminal-wheel.ts: wheelHasNothingToScroll(buffer, mouseTrackingMode) returns true only when mouse tracking is off.
  • Terminal.tsx: the wheel handler passes terminal.modes.mouseTrackingMode.
  • Test: the wheel is kept on a normal buffer with no scrollback for x10, vt200, drag and any. The existing cases pass "none".

Reproduce without tmux

A program that clears the screen and scrollback, turns on mouse reporting on the normal screen and logs what it reads:

printf '\033[?1049l\033[3J\033[H\033[2J\033[?1000h\033[?1002h\033[?1006h'; stty -icanon -echo; cat -v

Before: the wheel prints nothing. After: each notch prints an SGR wheel report (^[[<64;...M). Ctrl+C, then reset. This is the same sequence the program in my browser test sent; I did not run this exact one-liner.

Testing

  • npm test: 628 passed (79 files). tsc -p ., prettier --check on the changed files and npm run build are clean. The new test case fails without the change.
  • Checked in a browser on Termix 26.10.5 with a headless Chromium driving a real SSH session, on the same change applied to 1.1.1: on the normal screen state above, 0 of 5 wheel events reached the program before and 5 of 5 after. The alternate screen control and the after-resize case pass both before and after.
  • Not checked: macOS, Safari, Firefox, the Android app.

@termix-triage-bot

Copy link
Copy Markdown

AI review | Looks safe to merge

The PR fixes terminal wheel scrolling behavior when mouse reporting is enabled by passing the mouse tracking mode to the scroll check. The changes are safe, focused, and include appropriate tests. No issues found.

Reviewed 1c67981. AI can be wrong, a maintainer still decides. Comment /termix review to run it again.

@LukeGus
LukeGus changed the base branch from main to dev-1.4.0 November 7, 2026 03:08
@LukeGus
LukeGus merged commit 42f97b1 into Termix-SSH:dev-1.4.0 Nov 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants